package net.alche.fa.core.doing;
import net.alche.fa.core.model.Logic;
import net.alche.fa.core.model.FaValue;
import net.alche.fa.core.CodeLevel;
import net.alche.fa.core.SageStone;
import net.alche.fa.core.FaException;

//
// static/final
//
@FaAnnoDoing
public class StaticDo extends AbstractDoing {

  @Override
  public boolean matched(String what, Logic g) {
    return "static".equals(what);
  }

  @Override
  public FaValue doing(Logic g, CodeLevel lvl, SageStone st) throws FaException {
    CodeLevel cl = lvl.instanceDeep();
    cl.isStatic = true;
    st.runCode(g.getLogicObj(), cl);
    return lvl.returnObj;
  }
}